package com.ciwong.mobilelib.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.ListView;

/**
 * Created by res-mingyang on 2015/8/21.
 */
public class NoScrollListView extends ListView
{
    private boolean isScroll = true;

    public NoScrollListView(Context context, AttributeSet attrs,
            int defStyleAttr)
    {
        super(context, attrs, defStyleAttr);
    }

    public NoScrollListView(Context context, AttributeSet attrs)
    {
        this(context, attrs, 0);
    }

    public NoScrollListView(Context context)
    {
        this(context, null);
    }

    public void setScroll(boolean isScroll)
    {
        this.isScroll = isScroll;
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent event)
    {
        return super.onInterceptTouchEvent(event) && isScroll;
    }
}
